package com.wad.manager.controller;

import com.wad.manager.service.FileUploadService;
import com.wad.vo.common.Result;
import com.wad.vo.common.ResultCodeEnum;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author wad
 * @date 2023/12/03 14:42
 * @project e-commerce
 **/
@RestController
@RequestMapping(value = "/admin/system")
public class FileUploadController {


    @Resource
    private FileUploadService fileUploadService;

    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file){
        //获取上传的文件
        //调用service中的方法，返回minio路径
        String url=fileUploadService.upload(file);
        return Result.build(url, ResultCodeEnum.SUCCESS);
    }
}
